#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.stream;

public interface Pipeline<T,R> {
    /**
     * 执行流水线
     * @param t
     * @return
     */
    R exe(T t);

    /**
     * 添加步骤
     * @param pipeline
     * @return
     * @param <S>
     */
    default <S> Pipeline<T,S> addStep(Pipeline<R,S> pipeline) {
        return t -> pipeline.exe(exe(t));
    }

    /**
     * 构造流水线
     * @param pipeline
     * @return
     * @param <T>
     * @param <R>
     */
    static <T,R> Pipeline<T,R> of(Pipeline<T,R> pipeline) {
        return pipeline;
    }
}
